#include <stdio.h>

int main(void)
{
	int day;
	scanf("%d", &day);
	day += 2;
	if (day > 7) {
		day = day % 7;
	}

	printf("%d", day);

	return 0;
}